package com.example.es.dataobject;

import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

import java.util.Date;


@Builder
@Data
@Setting(shards = 3, replicas = 1)
@Document(indexName = "index_user")
public class ESUserDO {
    @Id
    @Field(store = true, name = "user_id", type = FieldType.Keyword)
    private String userId;

    @Field(store = true, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
    private String name;

    @Field(store = true, name = "login_name", type = FieldType.Keyword)
    private String loginName;

    @Field(store = true, type = FieldType.Integer)
    private Integer age;

    @Field(store = true, type = FieldType.Date)
    private Date birthday;

    @Field(store = true, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
    private String desc;

    @Field(store = true, name = "head_url", type = FieldType.Keyword)
    private String headUrl;
}
